const which = require('which')
const path = require('path')
const spawn = require('child_process').spawn

const nodeBin = which.sync('node')
const webpackBin = path.resolve(__dirname, '../node_modules/webpack/bin/webpack.js')
const theme = spawn(nodeBin, [
  webpackBin, '--watch', '--color', '--progress'
])
theme.stdout.pipe(process.stdout)
theme.stderr.pipe(process.stderr)

const jekyllBin = which.sync('jekyll')
const jekyll = spawn(jekyllBin, ['build', '--watch', '--config', '_config-dev.yml'])
jekyll.stdout.pipe(process.stdout)
jekyll.stderr.pipe(process.stderr)